#include<bits/stdc++.h>
#define N 22000000
#define inf 1e9+7
#define eps 1e-7
#define db double
#define ll long long
#define ldb long double
using namespace std;
inline int read()
{
	char ch=0;
	int x=0,flag=1;
	while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch-'0');ch=getchar();}
	return x*flag;
}
int tot,f[N];
char s[N],ch[N];
//struct node{int l,r;}p[N];
void manacher(int n)
{
	f[1]=1;
	for(int i=2,mid,r=1;i<=n;i++)
	{
		if(i>r)f[i]=1;
		else f[i]=min(f[2*mid-i],2*(r-i)+1);
		int x=f[i]/2;
		while(1<=i-x-1&&i+x+1<=n&&ch[i-x-1]==ch[i+x+1])
		{
			x++;f[i]+=2;
			//if(i+x>r)p[++tot]={i-x,i+x};
		}
		if(i+x>r)r=i+x,mid=i;
	}
}
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1),cnt=0;
	for(int i=1;i<=n;i++)ch[++cnt]='*',ch[++cnt]=s[i];ch[++cnt]='*';
	manacher(cnt);
	int ans=0;
	for(int i=1;i<=cnt;i++)ans=max(ans,f[i]/2);
	printf("%d",ans);
	return 0;
}
